using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_ULD_163 : SimTemplate //* 过期货物专卖商 Expired Merchant
	{
		CardDB.Card kid = null;
		//[x]<b>Battlecry:</b> Discard yourhighest Cost card.<b>Deathrattle:</b> Add 2 copiesof it to your hand.
		//<b>战吼：</b>弃掉你的法力值消耗最高的牌。<b>亡语：</b>将弃掉的牌的两张复制置入你的手牌。
		public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
		{
			kid = null;
			int maxCost = 0;
			Handmanager.Handcard hcc = null;
			bool found = false;
			foreach (Handmanager.Handcard hc in p.owncards)
			{
				if (!found && hc.card.chnName == "过期货物专卖商" )
                {
					found = true;
                    continue;
                }
				if(hc.card.cost > maxCost){
					hcc = hc;
					maxCost = hc.card.cost;
				}
			}
			if(hcc != null){
				Helpfunctions.Instance.ErrorLog("过期货物专卖商" + hcc.card.chnName);
				kid = hcc.card;
				p.removeCard(hcc);
			}
		}
		public override void onDeathrattle(Playfield p, Minion m)
		{
			if(kid != null) {
				Helpfunctions.Instance.ErrorLog("过期货物专卖商亡语获得" + kid.chnName);
				p.drawACard(kid.cardIDenum, m.own, true);
				p.drawACard(kid.cardIDenum, m.own, true);
			}
		}
	}
}